import { Component, Input, OnInit } from '@angular/core';
import { Observable } from 'rxjs';
import { ThreadsService } from 'src/app/services/threads.service';

@Component({
  selector: 'app-threads-poster-cover-embed',
  templateUrl: './threads-poster-cover-embed.component.html',
  styles: [`
  #poster-head{height:400px;background-repeat:no-repeat;background-position:center top;background-color:#fff}
  `]
})
export class ThreadsPosterCoverEmbedComponent implements OnInit {
  @Input('threads')
  public topicId!: number;
  public defPoster: string = 'assets/img/default.poster.bg.jpg';
  public poster$!: Observable<string>;

  constructor(private threadsService: ThreadsService) { }

  ngOnInit(): void {
    this.poster$ = this.threadsService.getCover(this.topicId, '640x400');
  }

}
